
function checkXM(){
 var xm=document.getElementById("xsxm");
 if(xm.value==""||xm.value.length==0){
	alert("姓名不能为空");
	canSubmit=false;
	return;
 }

}
function checkXH(){
 var xh=document.getElementById("xsxh");
 if(xh.value==""||xh.value.length==0){
	alert("学号不能为空");
	canSubmit=false;
	return;
 }

}

function checkNJ(){
 var nj=document.getElementById("nj");
 if(nj.value==""||nj.value.length==0){
	alert("年级不能为空");
	canSubmit=false;
	return;
 }

}

function checkBJ(){
 var bj=document.getElementById("bj");
 if(bj.value==""||bj.value.length==0){
	alert("班级不能为空");
	canSubmit=false;
	return;
 }

}
function checkXB(){
 var xb=document.getElementById("xb");
 if(xb.value==""||xb.value.length==0){
	alert("性别不能为空");
	canSubmit=false;
	return;
 }

}
function checkSFZH(){
 var sfzh=document.getElementById("sfzh");
 if(sfzh.value==""||sfzh.value.length==0){
	alert("身份证不能为空");
	canSubmit=false;
	return;
 }

}
function c_postcode(){
	var str= document.getElementById("form_postcode");
	if(str.value == ""||str.value.length == 0){
		alert("邮政编码不能为空");
		canSubmit = false;
		return;
	}else if(str.value.length !=6){
		alert("邮政编码位数不对");
		canSubmit = false;
		return;
	}else if(str.value.match("[^0-9]")){
		alert("邮政编码只能是数字");
		canSubmit = false;
		return;
	}
}

function c_qqnum(){
	var str= document.getElementById("form_qqnum");
	if(str.value == ""||str.value.length == 0){
		alert("QQ号码不能为空");
		canSubmit = false;
		return;
	}else if(str.value.length<5){
		alert("QQ号码位数不对");
		canSubmit = false;
		return;
	}else if(str.value.match("[^0-9]")){
		alert("QQ号码只能是数字");
		canSubmit = false;
		return;
	}
}

function c_mail(){
	var str= document.getElementById("form_mail");
	if(str.value == ""||str.value.length == 0){
		alert("邮箱地址不能为空");
		canSubmit = false;
		return;
	}
	else if(str.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1){
		alert("邮箱格式错误");
		canSubmit = false;
		return;
	}
}

function formsubmit(){
	var submitOK = true;
	canSubmit = true;
	checkXM();
	submitOK = submitOK & canSubmit;
	checkXH();
	submitOK = submitOK & canSubmit;
	checkNJ();
	submitOK = submitOK & canSubmit;
	checkBJ();
	submitOK = submitOK & canSubmit;
	checkXB();
	submitOK = submitOK & canSubmit;
	checkSFZH();
	submitOK = submitOK & canSubmit;
	return submitOK;
} 

function checkform()
{   
   if (!formsubmit())
   {
    alert("学生信息保存不成功！");
   }else{
   	document.saveform.submit();
   	return true;
   }
}